package cn.kmia.hrm.pojo.system;

import cn.kmia.hrm.pojo.BasePojo;
import org.nutz.dao.entity.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * @program: hrm
 * @description: 用户基础信息
 * @author: 4K
 * @create: 2018-04-13 16:34
 **/
@Table("sys_user")
public class User extends BasePojo implements Serializable {

    @Id
    private int id;

    /**
     * 用户姓名
     */
    @Column
    @Comment("用户姓名")
    @ColDefine(type = ColType.VARCHAR, width = 20)
    private String user_name;

    /**
     * 用户名
     */
    @Column
    @Comment("用户名")
    @ColDefine(type = ColType.VARCHAR, width = 20)
    private String user_idcard;

    /**
     * 用户密码
     */
    @Column
    @Comment("用户密码")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String user_pwd;

    @Column
    @Comment("盐")
    protected String user_salt;

    @Column
    @Comment("是否锁定")
    private boolean locked;

    @Column
    @Comment("所属组织机构ID")
    private int org_id;

    /**
     * 用户-角色
     */
    @ManyMany(from = "user_id", to = "role_id", relation = "sys_user_role")
    private List<Role> roles;

    /**
     * 角色名称
     */
    private String roleNames;

    /**
     * 用户-权限
     */
    private List<Permission> permissions;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getUser_idcard() {
        return user_idcard;
    }

    public void setUser_idcard(String user_idcard) {
        this.user_idcard = user_idcard;
    }

    public String getUser_pwd() {
        return user_pwd;
    }

    public void setUser_pwd(String user_pwd) {
        this.user_pwd = user_pwd;
    }

    public String getUser_salt() {
        return user_salt;
    }

    public void setUser_salt(String user_salt) {
        this.user_salt = user_salt;
    }

    public boolean isLocked() {
        return locked;
    }

    public void setLocked(boolean locked) {
        this.locked = locked;
    }

    public int getOrg_id() {
        return org_id;
    }

    public void setOrg_id(int org_id) {
        this.org_id = org_id;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    public String getRoleNames() {
        return roleNames;
    }

    public void setRoleNames(String roleNames) {
        this.roleNames = roleNames;
    }
}
